let arr = [1, 0, 2, 3, 4, 5, 2, 3, 4];
//indexOf去重
function removeRepeat(arr) {
  let res = [];
  for (let i of arr) {
    if (res.indexOf(i) == -1) {
      res.push(i);
    }
  }
  return res;
}
// set 去重
function removeRepeat(arr) {
  let res = new Set(arr);
  return Array.from(res);
}
// for循环去重
function removeRepeat(arr) {
  for (let i = 0; i < arr.length; i++) {
    for (let j = i + 1; j < arr.length; j++) {
      if (arr[i] == arr[j]) {
        arr.splice(j, 1);
        j--;
      }
    }
  }
  return arr;
}
// filter 去重
function removeRepeat(arr) {
  return arr.filter((item, index) => {
    return arr.indexOf(item) == index;
  });
}
// includes 去重
function removeRepeat(arr) {
  let res = [];
  for (let i of arr) {
    if (!res.includes(i)) {
      res.push(i);
    }
  }
  return res;
}
let res = removeRepeat(arr);
console.log(res);
